package com.bh.web.controller.fee;

import com.bh.common.annotation.Log;
import com.bh.common.core.controller.BaseController;
import com.bh.common.core.domain.AjaxResult;
import com.bh.common.enums.BusinessType;
import com.bh.fee.domain.JcOtherCost;
import com.bh.fee.service.IJcOtherCostService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 其他费用登记Controller
 * 
 * @author slx
 * @date 2023-07-02
 */
@RestController
@RequestMapping("/fee/otherCost")
public class JcOtherCostController extends BaseController
{
    @Autowired
    private IJcOtherCostService jcOtherCostService;

    /**
     * 查询其他费用登记列表
     */
    @ApiOperation("查询其他费用登记列表")
    @GetMapping("/list")
    public AjaxResult list(JcOtherCost jcOtherCost)
    {
        List<JcOtherCost> list = jcOtherCostService.selectJcOtherCostList(jcOtherCost);
        return AjaxResult.success(list);
    }

    /**
     * 获取其他费用登记详细信息
     */
    @ApiOperation("获取其他费用登记详细信息")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(jcOtherCostService.selectJcOtherCostById(id));
    }

    /**
     * 新增其他费用登记
     */
    @ApiOperation("新增其他费用登记")
    @Log(title = "其他费用登记", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JcOtherCost jcOtherCost)
    {
        return toAjax(jcOtherCostService.insertJcOtherCost(jcOtherCost));
    }

    /**
     * 修改其他费用登记
     */
    @ApiOperation("修改其他费用登记")
    @Log(title = "其他费用登记", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JcOtherCost jcOtherCost)
    {
        return toAjax(jcOtherCostService.updateJcOtherCost(jcOtherCost));
    }

    /**
     * 删除其他费用登记
     */
    @ApiOperation("删除其他费用登记")
    @Log(title = "其他费用登记", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jcOtherCostService.deleteJcOtherCostByIds(ids));
    }
}
